package com.booksystem.campuslibrarymanagementsystem.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.booksystem.campuslibrarymanagementsystem.entity.AccountTable;
import com.booksystem.campuslibrarymanagementsystem.entity.FeedbacksTable;
import com.booksystem.campuslibrarymanagementsystem.entity.ViolationTable;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface ViolationTableMapper extends BaseMapper<ViolationTable> {
    //    查询已处理违规人员信息
    @Select("select * from violation_table where status = #{status} ")
    List<ViolationTable> querydislist(String status);

    //   增加违规人员信息
    @Insert("INSERT INTO violation_table (account, bookid,fineamount,violationType, " +
            "violationDate, status) VALUES (#{account}, #{bookid},#{fineamount}, #{content}, #{time}, #{state})")
    int savav(ViolationTable vio);

    //删除该账户的违规记录
    @Delete("DELETE FROM violation_table WHERE account = #{account} AND bookid = #{bookid}")
    int deleteByAccountAndBookid(@Param("account") String account, @Param("bookid") int bookid);

    //通过账号和图书id修改罚款金额，违规人员，违规书籍，违规信息，违规时间
    @Update("update violation_table set fineamount = #{fineamount},violationType = #{violationType}")
    int upDataVio(String violationType,int fineamount);

    //通过账号和书籍查询单条信息
    @Select("select * from violation_table WHERE account = #{account} AND bookid = #{bookid}")
    ViolationTable queryvio(String account ,int bookid);

}
